{{template "header.html" .}}
<div id="form-result-message">
    <div class="message success hide">用户信息已更新</div>
    <div class="message error hide">用户信息更新失败：<span></span></div>
</div>
<div class="container" id="user-add-form-container">
    <div id="user-add-header" class="clear">
        <h1 class="h1 left">添加新用户</h1>
    </div>
    <form id="user-add-form" class="form clear" action="/admin/users/add" method="post">
        <div class="meta left">
            <p class="item">
                <label for="user-add-nick">昵称</label>
                <input id="user-add-nick" class="ipt" type="text" name="real_name"/>
            </p>
            <p class="item clear">
                <label for="user-add-desc" class="left">个人介绍</label>
                <textarea class="left ipt" name="bio" id="user-add-desc"></textarea>
            </p>
            <p class="item">
                <label for="user-add-status">状态</label>
                <select name="status" id="user-add-status" class="select">
                    <option value="active">启用</option>
                    <option value="inactive">不启用</option>
                </select>
            </p>
            <p class="item">
                <label for="user-add-role">角色名</label>
                <select name="role_name" id="user-add-role" class="select">
                    <option value="editor">编辑</option>
                    <option value="reader">读者</option>
                </select>
            </p>
            <p class="item submit">
                <button class="btn save" id="user-add-submit">创建用户</button>
            </p>
        </div>
        <div class="account left">
            <p class="item">
                <label for="user-add-account">用户名</label>
                <input id="user-add-account" class="ipt" type="text" name="user"/>
            </p>
            <p class="item">
                <label for="user-add-password">登录密码</label>
                <input id="user-add-password" class="ipt" type="password" name="password"/>
            </p>
            <p class="item">
                <label for="user-add-email">邮件</label>
                <input id="user-add-email" class="ipt" type="email" name="email"/>
            </p>
            <p class="item">
                <label for="user-add-url">联系网址</label>
                <input id="user-add-url" class="ipt" type="url" name="url"/>
            </p>
        </div>
    </form>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        ajaxForm("#user-add-form",function(json){
            if(json.res){
                window.location.href = "/admin/users/";
            }
        })
    });
</script>
</body>
</html>